#include <qobject.h>

#ifndef ADD_WARE_OBJECT
#define ADD_WARE_OBJECT


class AddWareController : public QObject 
{
  Q_OBJECT
  private :
    AddWareController(QWidget *parent=0, const char *name=0);
  
  public : //Static Public Member
    static AddWareController instance;

    static AddWareController * GetInstance();
    
  signals :
    void QuantitySet(double q, int parental);
    void WareAdded(int index, bool code_type, bool newsellreceipt);
    void Error(int er);
    void AuthRequest();

  public :
    void SetQuantity(double q, int parental);
    int  AddWare(const char * code, bool code_type, int parental);
    void EscapeQuantity();
    
    double GetQuantity();
    
    //void ClearModel();

  private :
    bool AuthorizationRequest(int r);
    bool GetAccess(bool code_type, int parental);
    bool CheckCode(const char * code, bool code_type);
    int AddNewPosition(const char * code, bool code_type, int & npos);
    void PositionCustomerDisplay(int pos);

  private :
    double quantity;
};


#endif
